package com.cy.controller;

import com.cy.entity.District;
import com.cy.service.IDistrictService;
import com.cy.util.JsonResult;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

import static com.cy.controller.BaseController.OK;

/**
 * 时间：2023/1/6
 */
@RequestMapping("/districts")
@RestController
public class DistrictController {
    @Resource
    private IDistrictService districtService;

    @RequestMapping({"/",""})
    public JsonResult<List<District>> getByParent(String parent){
        List<District> data = districtService.getByParent(parent);
        return new JsonResult<>(OK,data);
    }
}
